package MonthGame.problem3;

import java.util.Scanner;

public class Win {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int t = s.nextInt();
        for(int i=0;i<t;i++){
            long p = s.nextLong();
            long ans = 0;
            for(long j=1;j<p;j++){
                long temp = 1;
                long x = j;
                while(x>1){
                    x = p%x;
                    ++temp;
                }
                ans+=temp;
            }
            System.out.print(ans);
        }
    }
}
